home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / cron.daily / mlocate < prev    next >
Text File  |  2008-06-26  |  646b  |  38 lines

  1. #! /bin/bash
  2.  
  3. set -e
  4.  
  5. [ -x /usr/bin/updatedb.mlocate ] || exit 0
  6.  
  7. if which on_ac_power >/dev/null 2>&1; then
  8.     AC_POWER=0
  9.     on_ac_power >/dev/null 2>&1 || AC_POWER=$?
  10.     if [ "$AC_POWER" -eq 1 ]; then
  11.     echo >&2 "On battery power, not running today."
  12.     exit 1
  13.     fi
  14. fi
  15.  
  16. ##
  17.  
  18. LOCKFILE="/var/lib/mlocate/daily.lock"
  19.  
  20. trap "rm -f $LOCKFILE" EXIT
  21.  
  22. if [ -e "$LOCKFILE" ]; then
  23.     echo >&2 "Warning: $LOCKFILE present, not running today."
  24.     exit 1
  25. else
  26.     touch "$LOCKFILE"
  27. fi
  28.  
  29. ##
  30.  
  31. # See ionice(1)
  32. if [ -x /usr/bin/ionice ] &&
  33.     /usr/bin/ionice -c3 true 2>/dev/null; then
  34.     IONICE="/usr/bin/ionice -c3"
  35. fi
  36.  
  37. $IONICE /usr/bin/updatedb.mlocate
  38.